<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
	<%@ page import="bean.*" language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Best crime game in the world!</title>
<link href="css/tcss.css" rel="stylesheet" type="text/css" media="all">
<script type="text/javascript">
	function validateForm( formNumber, charAmount ) {
		if( formNumber == 1 ){
			var ele1 = document.forms["bankForm1"]["money"].value;
		} else {
			var ele1 = document.forms["bankForm2"]["money"].value;
		}
		if ( isNaN( ele1 ) || ele1 == "") {
			alert("This is not a good amount!");
			return false;
		} else if( ele1 > charAmount ){
			alert("You dont have that much!");
			return false;
		}else {
			return true;
		}
	}
</script>
</head>
<body>
	<div class="container">
		<div class="header">
			<img src="images/header.jpg"></img>
		</div>
		<div class="topMenu">
			<%@ include file="infoBar.jsp"%>
		</div>
		<div class="sideMenu">
			<%@ include file="menu.jsp"%>
		</div>
		<div class="center">
			<% CharacterBEAN characterBEAN = (CharacterBEAN) request.getAttribute( "character" ); %>
			<div class="bankPanel">
				Cash: $<% out.print( character.getMoneyCash() ); %>
				<br>Bank: $<% out.print( character.getMoneyBank() ); %>
			</div>
			<div class="bankPanel">
				<form name="bankForm1" action="Bank" onsubmit="return validateForm( 1, <% out.print( character.getMoneyCash() ); %> )" method="post">
					<input type="hidden" name="action" value="postMoney">
					<input type="text" size="20" name="money" value="<% out.print( characterBEAN.getMoneyCash()); %>" style="background-color: #C0C0C0">
					<input type="submit" value="Post" style="background-color: #C0C0C0">
				</form>
				<form name="bankForm2" action="Bank" onsubmit="return validateForm( 2, <% out.print( character.getMoneyBank() ); %> )" method="post">
					<input type="hidden" name="action" value="withdrawMoney">
					<input type="text" size="20" name="money" style="background-color: #C0C0C0">
					<input type="submit" value="withdraw" style="background-color: #C0C0C0">
				</form>
			</div>
		</div>
	</div>
</body>
</html>